<template>
    <el-image-viewer
      v-if="showPreview"
      :urlList="previewImages"
      :on-close="closeViewer"
    ></el-image-viewer>
  </template>
  <script>
  /* 
   * 引用方法
   * this.define.comUrl + file.url 图片路径
   * 页面调用 this.$openPreview([this.define.comUrl + file.url]) 
   */
  import ElImageViewer from "element-ui/packages/image/src/image-viewer";
  export default {
    data() {
      return {
        showPreview: false,
        previewImages: []
      };
    },
    components: {
      ElImageViewer
    },
    methods: {
      closeViewer() {
        this.showPreview = false;
      }
    }
  };
  </script>